# Contributor: Steffen Nurpmeso <steffen@sdaoden.eu>
# Contributor: Ivan Tham <pickfire@riseup.net>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=s-nail
pkgver=14.9.24
pkgrel=2
pkgdesc="SysV mail/BSD Mail/POSIX mailx: send and receive Internet mail"
options="suid"
url="https://www.sdaoden.eu/code.html#s-mailx"
arch="all"
license="BSD-3-Clause"
makedepends="openssl-dev>3 libidn2-dev ncurses-dev"
replaces="mailx"
subpackages="$pkgname-doc"
source="https://ftp.sdaoden.eu/s-nail-$pkgver.tar.xz"

build() {
	make \
		VAL_SID= VAL_MAILX=mail \
		VAL_PREFIX=/usr \
		VAL_SYSCONFDIR=/etc \
		\
		OPT_GSSAPI=no \
		VAL_IDNA=idn2 \
		VAL_RANDOM="tls,libgetrandom,urandom,builtin" \
		VAL_MAIL=/var/mail \
		\
		config
	make build
}

check() {
	make test
}

package() {
	make DESTDIR="$pkgdir" install

	install -Dm644 COPYING -t "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
03f6a6f446391b6f91ed3c8875c3e7fdfac9d4e77ea1d52a7e98aa84cfd0edae137d5b9afba3bdc9a31ab67cee5237930b74b42ae3acb54aee4758553a4f1df2  s-nail-14.9.24.tar.xz
"
